package com.zhuguowei.chapter_2_4;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.zhuguowei.chapter_2_4.aidl.BookManagerActivity;
import com.zhuguowei.chapter_2_4.provider.ProviderActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btn_binder).setOnClickListener(this);
        findViewById(R.id.btn_client_aidl).setOnClickListener(this);
        findViewById(R.id.btn_provider).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_binder:
                Intent binderService = new Intent(MainActivity.this,MessengerActivity.class);
                startActivity(binderService);
                break;
            case R.id.btn_client_aidl:
                Intent aidlService = new Intent(MainActivity.this,BookManagerActivity.class);
                startActivity(aidlService);
                break;
            case R.id.btn_provider:
                Intent provider = new Intent(MainActivity.this,ProviderActivity.class);
                startActivity(provider);
                break;
        }
    }
}
